<% content_for :header_tags do %>
    <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %>

<div class="contextual">
    <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %>
    <%= link_to(l(:label_issue_view_all), { :controller => 'issues' }) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %>
    <%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
    <%= link_to l(:label_overall_activity),
                { :controller => 'activities', :action => 'index',
                  :id => nil } %>
</div>

<%= form_tag({:controller => "favorite_projects", :action => "search"}, :method => :get,  :id => "query_form") do %> 
  <% no_filters = (params[:closed].blank? && params[:project_search].blank?) %> 

<h2>
  <%=l(:label_project_plural)%>

        <span class="live_search">  
            <%= text_field_tag(:project_search, params[:project_search], :autocomplete => "off", :class => "live_search_field", :placeholder => l(:label_search) ) %>    
            <%= javascript_tag "observeSearchfield('project_search', 'null', '#{ escape_javascript(search_favorite_projects_path(:format => "js")) }')" %>  
        </span>
</h2>


<div class="filters">   

    <fieldset id="filters" class="collapsible <%= 'collapsed' if no_filters %>">
      <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
      <div style="<%= 'display: none;' if no_filters %>">  
        <p>  
          <span class="filter-condition">        
            <label for="closed"><%= check_box_tag 'closed', 1, params[:closed] %> <%= l(:label_show_closed_projects) %></label>
          </span>
         
        </p>    

      </div>
    </fieldset> 
  
    <p class="buttons hide-when-print">
        <%= link_to l(:button_apply), "#", :onclick=>"$('#query_form').submit()", :class => 'icon icon-checked' %>
        <%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload'  %>
    </p>   

                                                         

</div>

<% end %>  

<div class="autoscroll" id="projects_list">
  <%= render :partial => 'projects/list' %>
</div>

<% if User.current.logged? %>
<p style="text-align:right;">
<span class="my-project"><%= l(:label_favorite_projects) %></span>
</p>
<% end %>


<% other_formats_links do |f| %>
	<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>

<% html_title(l(:label_project_plural)) -%>
